<?php
session_start();
ob_start();
if (!isset($_SESSION['loggedin'])) {

    header('Location: login.php');
}
?>
<?php include 'index.php';?>
<div id="body-wrapper">

    <div id="main-content">

        <div class="content-box">

            <div class="content-box-header">

                <h3><?= Manage_Products ?></h3>

                <div class="clear"></div>

            </div> 

            <div class="content-box-content">

                <div class="tab-content default-tab" id="tab1"> 

                    <table>
                        <thead>
                            <tr>
                                <th><input class="check-all" type="checkbox" /></th>
                                <th><?= product_name ?></th>
                                <th><?= product_cat ?></th>
                                <th><?= product_status ?></th>
                                <th><?= product_price ?></th>

                            </tr>

                        </thead>

                        <tfoot>
                            <tr>
                                <td colspan="6">
                                    <div class="bulk-actions align-left">
                                        <select name="dropdown">
                                            <option value="option1">Choose an action...</option>
                                            <option value="option2">Edit</option>
                                            <option value="option3">Delete</option>
                                        </select>
                                        <a class="button" href="#">Apply to selected</a>
                                    </div>

                                    <div class="pagination">
                                        <a href="#" title="First Page">&laquo; First</a><a href="#" title="Previous Page">&laquo; Previous</a>
                                        <a href="#" class="number" title="1">1</a>
                                        <a href="#" class="number" title="2">2</a>
                                        <a href="#" class="number current" title="3">3</a>
                                        <a href="#" class="number" title="4">4</a>
                                        <a href="#" title="Next Page">Next &raquo;</a><a href="#" title="Last Page">Last &raquo;</a>
                                    </div> <!-- End .pagination -->
                                    <div class="clear"></div>
                                </td>
                            </tr>
                        </tfoot>

                        <tbody>
                            <?php
                            include 'connection.php';
                            $query = 'SELECT * FROM products';
                            $result = mysql_query($query);
                            while ($row = mysql_fetch_array($result)) {
                                echo '
                                            <tr>
                                        <td><input type="checkbox" /></td>
                                        <td>' . $row['title_en'] . '</td>
                                        <td>' . $row['cat'] . '</td>
                                        <td>' . $row['status'] . '</td>
                                        <td>' . $row['price'] . '</td>
                                        <td>

                                            <!-- Icons -->
                                            <a href="UpdateProducts.php?type=Product&ID='.$row['id'].'" title="Update"><img src="resources/images/icons/pencil.png" alt="Update" /></a>
                                            <a href="DeleteProcudts.php?type=Product&ID='.$row['id'].'" title="Delete" ><img src="resources/images/icons/cross.png"  alt="Delete" /></a>
                                            <a href="" title="Edit Meta"><img src="resources/images/icons/hammer_screwdriver.png" alt="Edit Meta" />
                                        </td>
                                    </tr>';
                            }
               ?>
                        </tbody>

                    </table>

                </div> 

            </div> 

        </div>

    </div>

</div>